package edu.nf.ch06.service;

import edu.nf.ch06.entity.User;
import edu.nf.ch06.mapper.UserMapper;
import edu.nf.ch06.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

/**
 * @author wangl
 * @date 2025/4/24
 */
public class UserService {

    public User getUser(int id) {
        try(SqlSession session = MybatisUtils.getSqlSession()) {
            return session.getMapper(UserMapper.class).getUserById(id);
        }
    }
}